home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
PeerAware 1.03
/
PeerAware-Setup.exe
/
Html
/
hub.js
< prev
next >
Wrap
Text File
|
2008-08-31
|
7KB
|
257 lines
/*
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is PeerAware Workspace User Interface.
-
- The Initial Developer of the Original Code is
- Imunin Software Inc.
- Portions created by the Initial Developer are Copyright (C) 2006-2008
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- Alternatively, the contents of this file may be used under the terms of
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
*/
//Generic code for PeerAware.
var mode = 'w';
var iWorkspaceName;
var iMyName;
var iRemoteName;
var iConnectionStatus;
var iConnectionMode;
var iLoaded = false;
var gTextEditMode = false;
function SetStatus(aConnectionMode, aConnectionStatus, aWorkspaceName, aMyName, aRemoteName)
{
iWorkspaceName = aWorkspaceName;
iMyName = aMyName;
iRemoteName = aRemoteName;
iConnectionStatus = aConnectionStatus;
iConnectionMode = aConnectionMode;
}
function $2(aID){return document.getElementById(aID)}
function show(object){document.all[object].style.visibility='visible';document.all[object].style.display='';}
function hide(object){document.all[object].style.visibility='hidden';document.all[object].style.display='none';}
function handleclick(aID){
var tabobj=document.getElementById("tablist")
var tabobjlinks=tabobj.getElementsByTagName("li")
for (i=0; i<tabobjlinks.length; i++)
tabobjlinks[i].id="";
tabobjlinks[aID].id="current";
}
function setFocus()
{
try
{
document.getElementById("input").focus();
// at least Internet Explorer 7
//var gteIE7 = false /*@cc_on || @_jscript_version >= 5.7 @*/;
//if (!gteIE7)
{
var x = document.getElementById("c");
h = x.scrollHeight;
x.scrollTop = h;
}
}
catch (E){}
}
function Activate(object)
{
if (object=='w' && mode=='c')
{
handleclick(1);
var obj=document.getElementById("c");
var scroll=false;
if (obj.scrollHeight-obj.clientHeight <= obj.scrollTop)
scroll=true;
mode='w';
show('w');
setPageSize();
if (scroll)
{
obj.scrollTop = obj.scrollHeight
}
}
else if(object=='c' && mode=='w')
{
handleclick(0);
var obj=document.getElementById("c");
hide('w');
mode='c';
show('c');
}
}
function transmit(user, application, message)
{
if (typeof(window.external)!="undefined" && typeof(window.external.transmit)!="undefined")
window.external.transmit(user, application, message);
}
function broadcast(application, message)
{
if (typeof(window.external)!="undefined" && typeof(window.external.broadcast)!="undefined")
window.external.broadcast(application, message);
}
function scroll(message)
{
var x = document.getElementById("c");
var scroll=false;
if (x.scrollHeight-x.clientHeight <= x.scrollTop)
scroll=true;
var hr = document.createElement("div");
hr.innerHTML = message;
x.appendChild(hr);
if (scroll)
{
h = x.scrollHeight;
x.scrollTop = h;
}
}
function getTranslation(aID)
{
if (typeof(window.external)!="undefined" && typeof(window.external.getTranslation)!="undefined")
return window.external.getTranslation(aID);
}
function setLanguageStrings()
{
$2("input").title=getTranslation(214);
$2("sendbutton").value = getTranslation(215);
$2("whiteboardtitle").innerHTML = getTranslation(212);
$2("chattitle").innerHTML = getTranslation(211);
$2("welcome").innerHTML = getTranslation(237);
$2("pwlogin2").innerHTML = getTranslation(238);
$2("loginbutton2").value = getTranslation(239);
$2("rememberpw2").innerHTML = getTranslation(266);
}
function startPage()
{
setLanguageStrings();
Activate('c');
if (iLoaded==false)
{
if (typeof(window.external)!="undefined" && typeof(window.external.pageLoaded)!="undefined")
window.external.pageLoaded();
iLoaded = true;
}
}
function receive(aFrom, aApplication, aMessage)
{
if (aApplication == 'w')
{
setUser(iMyName);
handleRemoteCommand(aFrom + " " + aMessage);
}
}
function sendText()
{
if (typeof(window.external)!="undefined" && typeof(window.external.chat)!="undefined")
{
window.external.chat(document.getElementById("input").value);
document.getElementById("input").value="";
}
}
function CatchEvent (area, evt) {
if (evt.keyCode == 13 && !evt.shiftKey && !evt.ctrlKey && !evt.altKey) {
sendText();
}
}
function filter(area, evt) {
if (evt.keyCode == 13 && !evt.shiftKey && !evt.ctrlKey && !evt.altKey) {
return false;
}
return true;
}
function RequestPassword()
{
var body = document.getElementsByTagName("body")[0];
body.style.backgroundColor = "#f0f0f0";
hide("tabs1");
hide("w");
hide("c");
hide("editarea");
show("login");
//document.getElementById("loginname").innerHTML = iMyName;
//document.getElementById("workspacename").innerHTML = iWorkspaceName;
document.getElementById("password").focus();
}
function sendPw()
{
var body = document.getElementsByTagName("body")[0];
body.style.backgroundColor = "white";
if (typeof(window.external)!="undefined" && typeof(window.external.setPassword)!="undefined")
{
var remember;
if (document.getElementById("rememberpw").checked)
remember="Y";
window.external.setPassword(document.getElementById("password").value, remember);
document.getElementById("password").value="";
show("tabs1");
show("c");
show("editarea");
hide("login");
document.getElementById("input").focus();
}
}
function setPageSize()
{
if (mode=='w')
{
var obj=document.getElementById("c");
obj.style.height = 102;
obj.style.width = document.documentElement.clientWidth;
if (document.documentElement.clientHeight-222>0)
document.all["w"].height=document.documentElement.clientHeight-222;
setPageSize2();
}
else
{
var obj=document.getElementById("c");
obj.style.width = document.documentElement.clientWidth;
if (document.documentElement.clientHeight-117 > 0)
{
obj.style.height=document.documentElement.clientHeight-117;
}
}
}
function insert(text)
{
document.getElementById("input").focus();
sel = document.selection.createRange();
sel.text = text;
}